<?php

namespace app\admin\model\unidrink;

use think\Model;

/**
 * Class Printer
 * @package app\admin\model\unidrink
 * @property int $id
 * @property string $brand_id
 * @property string $device_id
 * @property string $device_secret
 * @property string $status
 * @property string $name
 * @property string $card
 * @property integer $number
 */
class Printers extends Model
{
    // 表名
    protected $name = 'unidrink_printers';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 品牌
    const BRAND_LIST = [
        'zhongwu' => '中午',
        'feie' => '飞鹅',
        'yilianyun' => '易联云',
    ];

    // 追加属性
    protected $append = [
        'brand'
    ];

    /**
     * 品牌信息
     */
    public function getBrandAttr($value, $data)
    {
        $config['title'] = self::BRAND_LIST[$data['brand_id']] ?? '';
        return $config;
    }







}
